package com.example.swimfish;

import org.glassfish.tyrus.server.Server;


public class WebSocketServer {
    private static final String HOST = "0.0.0.0";
    private static final int PORT = 8025;
    private Server server;

    public void start() {
        server = new Server(HOST, PORT, "/ws", null, FishServerEndpoint.class);
        try {
            server.start();
            System.out.println("WebSocket server started on ws://" + HOST + ":" + PORT);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public void stop() {
        if (server != null) {
            server.stop();
        }
    }
}

